﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nuclex.UserInterface.Controls.Desktop;
using Nuclex.UserInterface.Controls;
using Microsoft.Xna.Framework.Graphics;

namespace FierceWar
{
	public class ConfirmQuitDialog : WindowControl
	{
		private LabelControl _message;
		private ButtonControl _yes;
		private ButtonControl _no;
		public bool IsExitGame = false;

		public ConfirmQuitDialog(GraphicsDevice graphicsDevice,
			List<EventHandler> eventHandlers)
		{
			EnableDragging = false;

			// Message.
			_message = new LabelControl("Are you sure you want to quit ?");
			_message.Bounds = new Nuclex.UserInterface.UniRectangle(
				50.0f, 35.0f, 120.0f, 30.0f);

			// Yes button.
			_yes = new ButtonControl();
			_yes.Text = "Yes";
			_yes.Bounds = new Nuclex.UserInterface.UniRectangle(
				60.0f, 80.0f, 80.0f, 25.0f);
			_yes.Pressed += eventHandlers[0];

			// No button.
			_no = new ButtonControl();
			_no.Text = "No";
			_no.Bounds = new Nuclex.UserInterface.UniRectangle(
				160.0f, 80.0f, 80.0f, 25.0f);
			_no.Pressed += eventHandlers[1];

			// Dialog.
			float width = 300.0f;
			float height = 120.0f;
			Bounds = new Nuclex.UserInterface.UniRectangle(
				(graphicsDevice.Viewport.Width - width) / 2,
				(graphicsDevice.Viewport.Height - height) / 2,
				width, height);
			Title = "Confirm to Quit";
			Children.Add(_message);
			Children.Add(_yes);
			Children.Add(_no);
		}
	}
}
